package com.bestcem.xm.txtanls.controller.param.chart;

import com.bestcem.xm.txtanls.grpc.service.param.chart.BaseChartParam;
import com.bestcem.xm.txtanls.grpc.service.param.chart.PeriodChartParam;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.BeanUtils;

import java.time.LocalDate;

/**
 * 观点top查询
 * @author jy.zhao
 * @version 1.2
 * @date 2021/11/15 14:08
 **/
public class PeriodChartQuery extends BaseChartQuery {

    @ApiModelProperty(value = "0本期、1上期")
    @JsonProperty(value = "period")
    private Integer period;

    public PeriodChartParam getPeriodChartParam() {
        BaseChartParam baseChartParam = super.getBaseChartParam();
        PeriodChartParam periodChartParam = new PeriodChartParam();
        BeanUtils.copyProperties(baseChartParam, periodChartParam);
        periodChartParam.setPeriod(period);
        return periodChartParam;
    }

    public PeriodChartQuery(String projectId, String fieldId, String filterType, String current, LocalDate startTime, LocalDate endTime, Integer period) {
        super(projectId, fieldId, filterType, current, startTime, endTime);
        this.period = period;
    }
}
